<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="/WEB-INF/templates/layoutCourtier.xhtml">


	<ui:define name="content">

		<p:panel header="#{msgs.titrePanelPrincipal}"
			style="width:1200px;height:800px;">

			<p:panel style="width:100%;height:100%;">

				<h:panelGrid columns="2" cellpadding="2" border="1">

					<p:graphicImage value="images/network2.png" />

					<h:outputText value="___________#{msgs.titrePolice}__________" />

				</h:panelGrid>
			</p:panel>
			<h:form>
				<p:commandButton image="ui-icon ui-icon-star" immediate="true"
					style="width:120px" value="logout" action="#{manage.logout}"
					ajax="false" />
			</h:form>
			<h:form>

				<p:growl id="messages" />

				<p:menubar autoSubmenuDisplay="true">
					<p:submenu label="#{msgs.accueil}" icon="ui-icon ui-home">
						<p:menuitem value="#{msgs.accueil}" action="versaccueil"
							ajax="false" />
					</p:submenu>
					<p:submenu label="#{msgs.menuNouveau}"
						icon="ui-icon ui-icon-pencil">
						<p:menuitem value="#{msgs.client}"
							action="#{manage.versnouveauclient}" ajax="false" />
						<p:menuitem value="#{msgs.assureur}"
							action="#{manage.versnouvelassureur}" ajax="false" />
						<p:menuitem value="#{msgs.police}"
							action="#{manage.versnouvellepolice}" ajax="false" />
						<p:menuitem value="#{msgs.sinistre}"
							action="#{manage.versnouveausinistre}" ajax="false" />
					</p:submenu>

					<p:submenu label="#{msgs.menuListes}" icon="ui-icon ui-icon-star">
						<p:menuitem value="#{msgs.listeClients}" action="verslisteclients" />
						<p:menuitem value="#{msgs.listeAssureurs}"
							action="verslisteassureurs" />
						<p:menuitem value="#{msgs.listePolices}" action="verslistepolices" />
						<p:menuitem value="#{msgs.listeSinistres}"
							action="verslistesinistres" />
					</p:submenu>


					<p:submenu label="#{msgs.menuStatistiques}"
						icon="ui-icon ui-icon-star">
						<p:menuitem value="#{msgs.sinistralité}" action="verslistepolices" />

					</p:submenu>

					<p:submenu label="#{msgs.menuAide}" icon="ui-icon ui-icon-help">
						<p:menuitem value="#{msgs.menuAide}" url="#" />

					</p:submenu>

				</p:menubar>

			</h:form>

			<h:form>

				<p:dataTable var="police" widgetVar="police"
					rowStyleClass="#{police.actif?null:'sup'}"
					emptyMessage="Pas de police correspondant au critère de recherche"
					value="#{manage.serviceClient.toutesLesPolices}" paginator="true"
					rows="3" rowKey="#{police.key}" selection="#{manage.policeChoisie}"
					selectionMode="single"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} 
			{NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="3,10,15">

					<p:column filterBy="#{police.numeroPolice}"
						filterMatchMode="contains">
						<f:facet name="header">
							<h:outputText value="#{msgs.numero}" />
						</f:facet>
						<h:outputText value="#{police.numeroPolice}" />
					</p:column>

					<p:column sortBy="#{police.client.raisonSociale}">
						<f:facet name="header">
							<h:outputText value="#{msgs.assure}" />
						</f:facet>
						<h:outputText value="#{police.client.raisonSociale}" />
					</p:column>

					<p:column sortBy="#{police.assureur.raisonSociale}">
						<f:facet name="header">
							<h:outputText value="#{msgs.assureur}" />
						</f:facet>
						<h:outputText value="#{police.assureur.raisonSociale}" />
					</p:column>

					<p:column sortBy="#{police.dateDebut}">
						<f:facet name="header">
							<h:outputText value="#{msgs.dateDebut}" />
						</f:facet>
						<h:outputText value="#{police.dateDebut}">
							<f:convertDateTime dateStyle="short" />
						</h:outputText>
					</p:column>

					<p:column sortBy="#{police.dateFin}">
						<f:facet name="header">
							<h:outputText value="#{msgs.dateFin}" />

						</f:facet>
						<h:outputText value="#{police.dateFin}">
							<f:convertDateTime dateStyle="short" />
						</h:outputText>
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.prime}" />
						</f:facet>
						<h:outputText value="#{police.prime}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.total}" />
						</f:facet>
						<h:outputText value="#{manage.totalI(police)}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="___#{msgs.graphique}___" />
						</f:facet>
						<p:barChart value="#{manage.categoryModel(police)}"
							style="height:100px;" title="Prime/Indemnités" stacked="false"
							barMargin="100" min="0"
							max="#{manage.hauteurGraphique(police.prime)}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.statut}" />
						</f:facet>
						<h:outputText value="#{police.statut}" />
					</p:column>

					<f:facet name="footer">
						<p:commandButton value="#{msgs.modifier}"
							image="ui-icon ui-icon-search" update="display3"
							oncomplete="modif3.show()" />

						<p:commandButton value="#{msgs.supprimer}"
							image="ui-icon ui-icon-pencil" action="#{manage.supprimerPolice}" />

						<p:dialog header="#{msgs.cliqueModif}:" widgetVar="modif3"
							resizable="false" width="700" showEffect="clip" hideEffect="fold">

							<h:panelGrid id="display3" columns="2" cellpadding="4">


								<h:outputText value="#{msgs.numero}:" />
								<p:inplace>
									<p:inputText value="#{manage.police.numeroPolice}" />
								</p:inplace>

								<h:outputText value="#{msgs.dateDebut}:" />
								<h:inputText value="#{manage.police.dateDebut}"
									id="popupButtonDate1">
									<f:convertDateTime pattern="d/M/yyyy" />
								</h:inputText>

								<h:outputText value="#{msgs.dateFin}:" />
								<h:inputText value="#{manage.police.dateFin}"
									id="popupButtonDate2">
									<f:convertDateTime pattern="d/M/yyyy" />
								</h:inputText>

								<p:inplace>
									<p:inputText value="#{manage.police.prime}" />
								</p:inplace>

								<p:commandButton image="ui-icon ui-icon-disk"
									style="width:120px" value="#{msgs.enregistrer}"
									action="verslistepolices" ajax="false" />
							</h:panelGrid>

						</p:dialog>

					</f:facet>

				</p:dataTable>

			</h:form>

		</p:panel>
	</ui:define>
</ui:composition>